-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename graphql
export to g
#19
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: npm/@graphql-ts/[email protected] |
95da2a4
to
0c6cd63
Compare
6770a17
to
d06b3bc
Compare
112536e
to
0ba3717
Compare
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This renames the
graphql
export tog
for two reasons:graphql
from libraries such as Relay, GraphQL Code Generator and gql.tada that use the variable namegraphql
to declare GraphQL operationsThe
graphql
export still exists but is now deprecated and may be removed in a future release.To quickly update usages of the
graphql
export in your project to useg
:node_modules/@graphql-ts/schema/dist/declarations/src/schema-api-alias.d.ts
in your editor ("Go to Definition" will not take you to the correct file)graphql
tog
, this will update usages ofgraphql
tog
g
tographql
(avoid using "Rename Symbol" again because you want to preserve the updates you made in step 2)You can similarly use "Rename Symbol" to quickly rename your own custom defined
graphql
tog
.In case anyone is curious about the usage of the esoteric TypeScript-specific syntax of
export import ... = ...
inschema-api-alias.d.ts
, this does a subtle thing which is allowing us to alias the variable while also adding a JSDoc comment and preserving the types rather than just the values. Note two other similar syntaxes are insufficient:export const graphql = _graphql
would mean that the types (e.g.graphql.ObjectType<...>
/etc.) would be lost and only the runtime properties would be accessibleexport * as graphql from '...'
/export { _graphql as graphql }
/etc. doesn't allow for attaching a JSDoc comment to the alias to have the@deprecated
tag and other text